<?php
add_action('widgets_init','Reedwan_socialnetworks');


function Reedwan_socialnetworks(){
		register_widget("Reedwan_socialnetworks");
}


class Reedwan_socialnetworks extends WP_widget{
	
	function Reedwan_socialnetworks(){
		$options = array(
				"classname" => "socialnetworks",
				"description" => "Social networks links for header banner"
		);
		$this->WP_widget("socialnetworks","Social networks",$options);
	}
	
	function widget($args,$d){
		extract($args);
		echo $before_widget;
if ($d['title']) {
echo $before_title;
echo $d['title'];
echo $after_title;
}
		
		echo '<ul class="social-widget">';
		if($d['ID_facebook']) {
        echo '<li class="facebook"><a target="_blank" href="http://www.facebook.com/'.$d['ID_facebook'].'"></a></li>';
        }
		if($d['ID_twitter']) {
        echo '<li class="twitter"><a target="_blank" href="http://www.twitter.com/'.$d['ID_twitter'].'"></a></li>';
        }
		if($d['ID_feedburner']) {
        echo '<li class="feedburner"><a target="_blank" href="http://feeds.feedburner.com/'.$d['ID_feedburner'].'"></a></li>';
        }
		if($d['ID_vimeo']) {
        echo '<li class="vimeo"><a target="_blank" href="http://www.vimeo.com/'.$d['ID_vimeo'].'"></a></li>';
        }
		
		if($d['ID_linkedin']) {
        echo '<li class="linkedin"><a target="_blank" href="http://www.linkedin.com/'.$d['ID_linkedin'].'"></a></li>';
        }
		if($d['ID_deviantart']) {
        echo '<li class="deviantart"><a target="_blank" href="http://www.deviantart.com/'.$d['ID_deviantart'].'"></a></li>';
        }
		if($d['ID_youtube']) {
        echo '<li class="youtube"><a target="_blank" href="http://www.youtube.com/'.$d['ID_youtube'].'"></a></li>';
        }
		if($d['ID_flickr']) {
        echo '<li class="flickr"><a target="_blank" href="http://www.flickr.com/'.$d['ID_flickr'].'"></a></li>';
        }
		if($d['ID_pinterest']) {
        echo '<li class="pinterest"><a target="_blank" href="http://pinterest.com/'.$d['ID_pinterest'].'"></a></li>';
        }
		if($d['ID_soundcloud']) {
        echo '<li class="soundcloud"><a target="_blank" href="http://soundcloud.com/'.$d['ID_soundcloud'].'"></a></li>';
        }
		if($d['ID_dribbble']) {
        echo '<li class="dribbble"><a target="_blank" href="http://dribbble.com//'.$d['ID_dribbble'].'"></a></li>';
        }
		if($d['ID_digg']) {
        echo '<li class="digg"><a target="_blank" href="http://digg.com/'.$d['ID_digg'].'"></a></li>';
        }
        echo '</ul>';
		echo $after_widget;
	}
	
	function update($new,$old){
		return $new;
	}
	
	function form($d){
		?>
        <p>
        	<label for="<?php echo $this->get_field_id('title'); ?>">Title :</label>
            <input name="<?php echo $this->get_field_name('title'); ?>" id="<?php echo $this->get_field_id('title') ; ?>" type="text" value="<?php echo $d['title']; ?>" />
        </p>
        
        <p>
        	<label for="<?php echo $this->get_field_id('ID_facebook'); ?>">Facebook ID :</label>
            <input name="<?php echo $this->get_field_name('ID_facebook'); ?>" id="<?php echo $this->get_field_id('ID_facebook') ; ?>" type="text" value="<?php echo $d['ID_facebook']; ?>" />
        </p>
        
       
        <p>
        	<label for="<?php echo $this->get_field_id('ID_twitter'); ?>">Twitter ID :</label>
            <input name="<?php echo $this->get_field_name('ID_twitter'); ?>" id="<?php echo $this->get_field_id('ID_twitter') ; ?>" type="text" value="<?php echo $d['ID_twitter']; ?>" />
        </p>
  
		
        <p>
        	<label for="<?php echo $this->get_field_id('ID_vimeo'); ?>">Vimeo ID :</label>
            <input name="<?php echo $this->get_field_name('ID_vimeo'); ?>" id="<?php echo $this->get_field_id('ID_vimeo') ; ?>" type="text" value="<?php echo $d['ID_vimeo']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('ID_feedburner'); ?>">Feedburner ID :</label>
            <input name="<?php echo $this->get_field_name('ID_feedburner'); ?>" id="<?php echo $this->get_field_id('ID_feedburner') ; ?>" type="text" value="<?php echo $d['ID_feedburner']; ?>" />
        </p>
        
      
        <p>
        	<label for="<?php echo $this->get_field_id('ID_youtube'); ?>">Youtube ID :</label>
            <input name="<?php echo $this->get_field_name('ID_youtube'); ?>" id="<?php echo $this->get_field_id('ID_youtube') ; ?>" type="text" value="<?php echo $d['ID_youtube']; ?>" />
        </p>
        
       
        <p>
        	<label for="<?php echo $this->get_field_id('ID_flickr'); ?>">Flickr ID :</label>
            <input name="<?php echo $this->get_field_name('ID_flickr'); ?>" id="<?php echo $this->get_field_id('ID_flickr') ; ?>" type="text" value="<?php echo $d['ID_flickr']; ?>" />
        </p>
        
        
        <p>
        	<label for="<?php echo $this->get_field_id('ID_linkedin'); ?>">Linkedin ID :</label>
            <input name="<?php echo $this->get_field_name('ID_linkedin'); ?>" id="<?php echo $this->get_field_id('ID_linkedin') ; ?>" type="text" value="<?php echo $d['ID_linkedin']; ?>" />
        </p>
        
        <p>
        	<label for="<?php echo $this->get_field_id('ID_deviantart'); ?>">Deviantart ID :</label>
            <input name="<?php echo $this->get_field_name('ID_deviantart'); ?>" id="<?php echo $this->get_field_id('ID_deviantart') ; ?>" type="text" value="<?php echo $d['ID_deviantart']; ?>" />
        </p>
		
		<p>
        	<label for="<?php echo $this->get_field_id('ID_pinterest'); ?>">Pinterest ID :</label>
            <input name="<?php echo $this->get_field_name('ID_pinterest'); ?>" id="<?php echo $this->get_field_id('ID_pinterest') ; ?>" type="text" value="<?php echo $d['ID_pinterest']; ?>" />
        </p>
		
		<p>
        	<label for="<?php echo $this->get_field_id('ID_soundcloud'); ?>">Soundcloud ID :</label>
            <input name="<?php echo $this->get_field_name('ID_soundcloud'); ?>" id="<?php echo $this->get_field_id('ID_soundcloud') ; ?>" type="text" value="<?php echo $d['ID_soundcloud']; ?>" />
        </p>
		
		<p>
        	<label for="<?php echo $this->get_field_id('ID_dribbble'); ?>">Dribbble ID :</label>
            <input name="<?php echo $this->get_field_name('ID_dribbble'); ?>" id="<?php echo $this->get_field_id('ID_dribbble') ; ?>" type="text" value="<?php echo $d['ID_dribbble']; ?>" />
        </p>
		
		<p>
        	<label for="<?php echo $this->get_field_id('ID_digg'); ?>">Digg ID :</label>
            <input name="<?php echo $this->get_field_name('ID_digg'); ?>" id="<?php echo $this->get_field_id('ID_digg') ; ?>" type="text" value="<?php echo $d['ID_digg']; ?>" />
        </p>
        <?php
	}
}
?>